package game.editer.ui;

import hx.display.Label;
import hx.display.HBox;

class BaseAttributeInput extends HBox implements IAttributeInput {
	public var onAttributeChange:IAttributeInput->Void;
	public var key:String;
	public var titleText:String;

	public var value(get, set):Dynamic;

	private var __value:Dynamic = null;

	private function get_value():Dynamic {
		return __value;
	}

	private function set_value(value:Dynamic):Dynamic {
		__value = value;
		return __value;
	}

	public function new(title:String, key:String, onAttributeChange:IAttributeInput->Void) {
		this.titleText = title;
		this.key = key;
		this.onAttributeChange = onAttributeChange;
		super();
	}

	override function onInit() {
		super.onInit();
		this.gap = 8;
		this.verticalAlign = MIDDLE;
		this.height = 30;
		var title = new Label(this.titleText, Config.COMMON_TEXT_FORMAT);
		title.width = 105;
		title.horizontalAlign = RIGHT;
		title.wordWrap = false;
		this.addChild(title);
	}
}
